AR  := ar
LD  := ld
GCC := gcc
CCFLAG := -m32 -I../../include -nostdinc -ffreestanding -fno-pic -Wall -fomit-frame-pointer -fno-stack-protector -c
OBJS   := tty_io.o console.o keyboard.o tty_ioctl.o

chr_drv.a : $(OBJS)
		$(AR) rcs $@ $^
		sync

tty_io.o : tty_io.c
		$(GCC) $(CCFLAG) -o $@ $<

kboard.o : kboard.c
		$(GCC) $(CCFLAG) -o $@ $<

keyboard.o : keyboard.S
	$(GCC) -m32 -traditional -c -o $@ $<

console.o : console.c
		$(GCC) $(CCFLAG) -o $@ $<

tty_ioctl.o : tty_ioctl.c
		$(GCC) $(CCFLAG) -o $@ $<

clean : 
		-rm *.o
		-rm chr_drv.a

